package hqu.cst.xah.mapper;


import hqu.cst.xah.pojo.Product;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProductMapper {

    @Select("select * from products")
    List<Product> selectList(Object o);

    @Select("select * from products where id=#{id}")
    Product selectById(Long id);

    @Insert("insert into products(name,price,stock,description) values(#{name},#{price},#{stock},#{description})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insert(Product product);

    @Update("update products set name=#{name},price=#{price},stock=#{stock},description=#{description} where id=#{id}")
    void updateById(Product product);

    @Delete("delete from products where id=#{id}")
    void deleteById(Long id);
}
